using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;

namespace Avinor.NET
{
    public class AvinorAirlineParser : AvinorParser
    {
        public AvinorAirlineParser(Stream stream) : base(stream) {}

        public IEnumerable<Airline> GetAirlines()
        {
            var airlines = from airlineName in GetDescendants("airlineName")
                select new Airline()
                   {
                       Code = airlineName.Attribute("code").Value,
                       Name = airlineName.Attribute("name").Value
                   };
            return airlines;

        }
    }
}